import { http } from '@/utils/http/axios';

const prefix = "http://localhost";
const prefixDict = "http://localhost";

/**
 * 医院列表
 */
export function getHospList(page: string, limit: string, searchObj: any) {
  return http.request({
    url: `${prefix}/admin/hosp/hospital/list/${page}/${limit}`,
    method: 'GET',
    params: searchObj
  })
}

/**
 * 根据dictCode查询所有子节点
 */
export function findByDictCode(dictCode ) {
  return http.request({
    url: `${prefixDict}/admin/cmn/dict/findByDictCode/${dictCode}`,
    method: 'GET'
  })
}
/**
 * 根据数据id查询子数据列表
 */
export function findChildId(id) {
  return http.request({
    url: `${prefixDict}/admin/cmn/dict/findChildData/${id}`,
    method: 'GET'
  })
}

export function updaeHospStatus(id, status) {
  return http.request({
    url: `${prefix}/admin/hosp/hospital/updateHospStatus/${id}/${status}`,
    method: 'get',
  });
};

// 查看医院详情
export function getHospById(id) {
  return http.request({
    url: `${prefix}/admin/hosp/hospital/showHospDetail/${id}`,
    method: 'get',
  });
};


// 查看医院科室
export function getDeptByHoscode(hoscode) {
  return http.request({
    url: `${prefix}/admin/hosp/department/getDeptList/${hoscode}`,
    method: 'get',
  });
}
// 查看预约规则
export function getScheduleRule(page,limit,hoscode, depcode) {
  return http.request({
    url: `${prefix}/admin/hosp/schedule/getScheduleRule/${page}/${limit}/${hoscode}/${depcode}`,
    method: 'get',
  });
}

// 查询医院编号, 科室编号和工作日期, 查询排班详细信息
export function getScheduleDetail(hoscode, depcode, workDate) {
  return http.request({
    url: `${prefix}/admin/hosp/schedule/getScheduleDetail/${hoscode}/${depcode}/${workDate}`,
    method: 'get',
  });
}
